<script setup lang="ts">
import { useRouter } from 'vue-router';

import {
  BxExport,
  BxImport,
  MingcuteSave2Line,
  SystemUiconsWrapBack,
} from '@vben/icons';

import { ElIcon } from 'element-plus';

import plottingSceneManager from '#/store/modules/plotting-scene-manager';

const emit = defineEmits(['saveScene']);

const router = useRouter();

const backScene = () => {
  router.back();
};

const saveScene = () => {
  emit('saveScene');
};
</script>

<template>
  <div class="main">
    {{ plottingSceneManager.getScene()?.name || '标绘场景' }}
    <div class="left-btn">
      <ElIcon size="32" color="#ccc" @click="backScene">
        <SystemUiconsWrapBack />
      </ElIcon>
    </div>
    <div class="right-btn">
      <ElIcon size="32" color="#ccc" @click="saveScene">
        <BxImport />
      </ElIcon>
      <ElIcon size="32" color="#ccc" @click="backScene">
        <BxExport />
      </ElIcon>
      <ElIcon size="32" color="#ccc" @click="saveScene">
        <MingcuteSave2Line />
      </ElIcon>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.main {
  position: relative;
  display: flex;
  flex-direction: row;
  justify-content: center;
  font-size: calc(0.8vh + 0.8vw);
  line-height: 6vh;
  color: #ccc;
  text-align: center;
  background-color: #2e3138;
  // border-bottom: solid 2px #409EFF;
}

.common-btn {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80%;
}

.left-btn {
  /* stylelint-disable-next-line at-rule-no-unknown */
  @extend .common-btn;
  // border-right: #ccc 1px solid;
  position: absolute;
  top: 0;
  left: 0;
  width: 60px;
  height: 65px;
}

.right-btn {
  /* stylelint-disable-next-line at-rule-no-unknown */
  @extend .common-btn;

  position: absolute;
  top: 0;
  right: 40px;
  gap: 10px;
  width: 60px;
  height: 65px;
}

.common-btn .el-icon:hover {
  color: #fff;
  cursor: pointer;
  transition: all 0.3s;
  transform: scale(1.1);
}
</style>
